<?php

namespace app\model\wireless;

use app\BaseModel;
use app\model\not_del\RatingScaleModel as NotDelRatingScaleModel;
use app\model\not_del\UserModel;
use think\model\relation\BelongsTo;

/**
 * 无线测评任务
 */
class WirelessTaskModel extends BaseModel
{
    protected $name = 'wireless_task';

    /**
     * 用户
     * @return BelongsTo
     */
    public function user(): BelongsTo
    {
        return $this->belongsTo(UserModel::class,'uid')->bind([
            'user_name' => 'name',
        ]);
    }

    /**
     * 关联量表
     * @return BelongsTo
     */
    public function ratingScale(): BelongsTo
    {
        return $this->belongsTo(NotDelRatingScaleModel::class,'rating_scale_id')->bind([
            'rating_scale_name' => 'name',
            'rating_scale_cover' => 'cover',
        ]);
    }
}